//
//  FeeMainVC.m
//  test
//
//  Created by 李彦宏 on 2018/3/8.
//  Copyright © 2018年 朱圳. All rights reserved.
//

#import "FeeMainVC.h"
#import "MainOtherFeeVC.h"//其他费用
#import "MainLecturiVC.h"//课程费用
#import "JWUserManager.h"
#import "JWGRUsermodel.h"


@interface FeeMainVC ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSArray *Feelist;
@property (nonatomic, strong) JWGRUsermodel *model;
@end

@implementation FeeMainVC
//UItableView初始化
- (void)setupTable
{
    UITableView *tableView=[[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
    //隐藏组距导航栏的间距
    tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, CGFLOAT_MIN)];
    tableView.backgroundColor=[UIColor whiteColor];
    tableView.showsHorizontalScrollIndicator=NO;
    tableView.showsVerticalScrollIndicator=NO;
    tableView.dataSource=self;
    tableView.delegate=self;
    tableView.separatorStyle=UITableViewCellSeparatorStyleSingleLine;
    [self.view addSubview:tableView];
    self.tableView=tableView;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupTable];
    self.model=[JWUserManager Gme];
    _Feelist=[NSArray arrayWithObjects:@"课酬费用",@"其他费用", nil];
    // Do any additional setup after loading the view.
}
#pragma -mark -----------------------------tableview datasource and delegate---------------------------------
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 2;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 45;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    // 1.创建cell
    static NSString *ID = @"cell111";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
        cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    }
    
    // 2.设置cell的数据
    cell.textLabel.text = _Feelist[indexPath.row];
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
    if(indexPath.row==0){
        MainLecturiVC *vc=[[MainLecturiVC alloc]init];
        vc.title=[NSString stringWithFormat:@"%@的课酬费用",self.model.name];
        
        [self.navigationController pushViewController:vc animated:YES];
    }else{
        MainOtherFeeVC *vc1=[[MainOtherFeeVC alloc]init];
         vc1.title=[NSString stringWithFormat:@"%@的其他费用",self.model.name];
        [self.navigationController pushViewController:vc1 animated:YES];
        
    }
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 1;
}


- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 1;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
